package cn.iocoder.yudao.module.wine.dal.mysql.teamtype;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.wine.controller.app.teamtype.vo.AppTeamTypePageReqVO;
import cn.iocoder.yudao.module.wine.dal.dataobject.teamtype.TeamTypeDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.wine.controller.admin.teamtype.vo.*;

/**
 * 团长缴费等级 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface TeamTypeMapper extends BaseMapperX<TeamTypeDO> {

    default PageResult<TeamTypeDO> selectPage(TeamTypePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<TeamTypeDO>()
                .likeIfPresent(TeamTypeDO::getName, reqVO.getName())
                .eqIfPresent(TeamTypeDO::getPrice, reqVO.getPrice())
                .eqIfPresent(TeamTypeDO::getOriginalPrice, reqVO.getOriginalPrice())
                .eqIfPresent(TeamTypeDO::getIcon, reqVO.getIcon())
                .eqIfPresent(TeamTypeDO::getEquities, reqVO.getEquities())
                .eqIfPresent(TeamTypeDO::getCommissionRate, reqVO.getCommissionRate())
                .eqIfPresent(TeamTypeDO::getTermType, reqVO.getTermType())
                .betweenIfPresent(TeamTypeDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(TeamTypeDO::getId));
    }

    default List<TeamTypeDO> selectPTeamTypeList(AppTeamTypePageReqVO reqVO){
        return selectList(new LambdaQueryWrapperX<TeamTypeDO>()
                .likeIfPresent(TeamTypeDO::getName, reqVO.getName())
                .eqIfPresent(TeamTypeDO::getPrice, reqVO.getPrice())
                .eqIfPresent(TeamTypeDO::getOriginalPrice, reqVO.getOriginalPrice())
                .eqIfPresent(TeamTypeDO::getIcon, reqVO.getIcon())
                .eqIfPresent(TeamTypeDO::getEquities, reqVO.getEquities())
                .eqIfPresent(TeamTypeDO::getCommissionRate, reqVO.getCommissionRate())
                .eqIfPresent(TeamTypeDO::getTermType, reqVO.getTermType())
                .orderByDesc(TeamTypeDO::getId));
    }
}
